CC=gcc
AR=ar
CWD=$(shell pwd)
OBJPATH=$(CWD)/../build/objs
LIBPATH=$(CWD)/../build/lib
SYSCORELIB=libsyscore.a
EXPORTDIR=$(CWD)/../exports

COPTIONS=
NCOPTIONS=$(COPTIONS)

ifeq ($(ARCH32),YES)
NCOPTIONS=-m32 $(COPTIONS)
endif

OBJS=\
	$(OBJPATH)/syscore.o \
	$(OBJPATH)/timer.o \
	$(OBJPATH)/storage.o

SYSCORELIB: action $(OBJS)
	$(AR) -crs $(LIBPATH)/$(SYSCORELIB) $(OBJS)
	
%.o:
	$(CC) -c $(NCOPTIONS) $(*F).c  -o $@   
	


action:
	@mkdir -p $(OBJPATH)
	@mkdir -p $(LIBPATH)
	@cp -f syscore.h $(EXPORTDIR)
clean:
	@rm -f $(LIBPATH)/$(SYSCORELIB) $(OBJS)